package uk.co.itmentor.pmff.util;
/**
 * The class provides reflection API for Java generic types
 * @author mdylag
 *
 */
public class ReflectUtil {
	/**
	 * Create new instance of object.
	 * @param <T>
	 * @param object
	 * @return
	 * @throws InstantiationException
	 * @throws IllegalAccessException
	 */
	public static <T> T newInstance (T object) throws InstantiationException, IllegalAccessException
	{
	   Object newObject = object.getClass().newInstance();
	   return (T) newObject;
	}
	
	
	public static <T> T newInstance (Class<T> object) throws InstantiationException, IllegalAccessException
	{
	   Object newObject = object.newInstance();
	   return (T) newObject;
	}
	
	
}

